<div ng-if="pagedata.ischecklogin=='showmodal'" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="background:url('{{siteroot}}../core/resource/images/login-bg-sm.jpg');background-size: 100%;">
		<div class="top" style="margin-top:-1.5rem;z-index:108">
			<div class="c">
				<img style="width:3rem;height:3rem;border-radius:100%" ng-src="{{tomedia(pagedata.account.logo) || '../core/resource/images/gw-user.png'}}"  />
			</div>
		</div>
		<div class="fui-line-title" style="padding-top:0">
			<div>{{pagedata.account.title}}</div>
		</div>
		<div class="fui-content" style="position:relative;background:none;height:auto;width:auto;padding:1rem 0.5rem;margin-bottom:1rem">
			<div style="padding:0 0.5rem">
				<div class="fui-code" style="background: none;border-radius: 0.5rem;padding-bottom:1rem">
				<div class="fui-cell-group" ng-show="pagedata.checklogin.item.show_type" style="margin-top:0;background:none">
					<div class="fui-tab fui-tab-success" style="background:none">
							<a ng-class="{'active':pagedata.checklogin.item.login_type!=1}" ng-click="pagedata.checklogin.item.login_type=0">账号登陆</a>
							<a ng-class="{'active':pagedata.checklogin.item.login_type==1}" ng-click="pagedata.checklogin.item.login_type=1">手机登陆</a>
					</div>
				</div>
				<div class="fui-cell-group radius" style="background:none" ng-show="pagedata.checklogin.item.login_type != 1">
					<div class="fui-cell must" style="height:auto;">
						<div class="fui-cell-label" style="width:3rem">账号</div>
						<div class="fui-cell-info">
						<input type="text" class='fui-input' list="history" name="username" placeholder="请输入账号"  ng-model="pagedata.checklogin.item.username" />
						<datalist id="history" style="max-height:5rem;overflow-y:scroll">
						  <option ng-repeat="h in pagedata.Storageusernames track by $index" value="{{h.username}}">
						</datalist>
						</div>
					</div>
					<div class="fui-cell must" style="height:auto;">
						<div class="fui-cell-label" style="width:3rem">密码</div>
						<div class="fui-cell-info"><input type="password" class='fui-input' placeholder="请输入密码" ng-model="pagedata.checklogin.item.password" /></div>
					</div>
				</div>
				
				<div class="fui-cell-group radius" style="background:none" ng-show="pagedata.checklogin.item.login_type==1">
					<div class="fui-cell must" style="height:auto;">
						<div class="fui-cell-label" style="width:3rem">手机号</div>
						<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入您的手机号"  ng-model="pagedata.checklogin.item.mobile" /></div>
						<div class="fui-cell-remark noremark"><a class="btn btn-default btn-default-o btn-sm" ng-click="tool.mobile_code(pagedata.checklogin.item.mobile,'core/member.login/smscode/')" id="smscode">获取验证码</a></div>
					</div>
					<div class="fui-cell must" style="height:auto;">
						<div class="fui-cell-label" style="width:3rem">验证码</div>
						<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入验证码" ng-model="pagedata.checklogin.item.smscode" /></div>
					</div>
				</div>
				</div>
				<button class="weui_btn weui_btn_primary sysbgcolor" style="margin: auto;margin-top:1.5rem;width:80%;" href='javascript:;' ng-click="post(pagedata.checklogin.item,'core/member.login/login/');pagedata.localStorageusername();">登录</button>
				<div ng-if="(pagedata.checklogin.item.no_openidlogin!=1 && pagedata.checklogin.item.openid) || pagedata.checklogin.openlogin" class="fui-cellone" style="padding-top:0.4rem">
						<div ng-if="!pagedata.checklogin.openlogin" class="fui-cellone-info c" style="padding-right:20px">
							<img src="../core/resource/images/icon/wechat.png" style="width:0.65rem;height:0.65rem"/>
							<a class="syscolor" style="font-size:0.65rem;line-height:1rem" href="javascript:;" ng-click="post(pagedata.checklogin.item,'core/member.login/wechat_login/')">{{pagedata.checklogin.opentitle||'微信'}}一键登录</a>
						</div>
						<div ng-if="pagedata.checklogin.openlogin" class="fui-cellone-info c" style="padding-right:20px">
							<img src="../core/resource/images/icon/wechat.png" style="width:0.65rem;height:0.65rem"/>
							<a class="syscolor" style="font-size:0.65rem;" href="javascript:;" ng-click="post(pagedata.checklogin.item,'core/member.login/wxapp_login/')">{{pagedata.checklogin.opentitle}}一键登录</a>
						</div>
				</div>
				<div class="form-group other-login-line">			
						<div class="login-footer">
						<span class="l-f" style="margin-left:1rem"> 还没有账号？<a class="action" href="javascript:;" ng-click="access_json(pagedata.registerurl?pagedata.registerurl:'core/member.register/')">去注册</a></span>
						<span class="r-f" style="margin-right:1rem"><a class="action" href="javascript:;" ng-click="access_json('core/member.change/')">忘记密码？</a></span>
						</div>
				</div>
			</div>		
		</div>
		</div>
	</div>
	<script>
	scope.pagedata.checklogin={'item':{}}
	scope.pagedata.getchecklogin=function(){
		scope.get('core/member.login/get/',function(res){
			scope.pagedata.checklogin=res;
			scope.$evalAsync();
		});
	}
	scope.pagedata.getchecklogin();
	scope.pagedata.Storageusernames=localStorage.getItem('usernames');
	if(scope.pagedata.Storageusernames){
		//console.log(scope.pagedata.Storageusernames)
		scope.pagedata.Storageusernames=JSON.parse(scope.pagedata.Storageusernames)
	}else{
		scope.pagedata.Storageusernames=[]
	}
	scope.pagedata.localStorageusername=function(){
		for(var i=0;i<scope.pagedata.Storageusernames.length;i++){
			if(scope.pagedata.Storageusernames[i].username==scope.pagedata.checklogin.item.username){
				return '';
			}
		}
		var item={
			'username':scope.pagedata.checklogin.item.username,
			'password':scope.pagedata.checklogin.item.password
		}
		scope.pagedata.Storageusernames.push(item);
		localStorage.setItem('usernames',JSON.stringify(scope.pagedata.Storageusernames));
	}
	</script>
	<script>
	if(scope.main.isapp==1){
		// 监听plusready事件  
		document.addEventListener("plusready", function() {
			// 扩展API加载完毕，现在可以正常调用扩展API  
			plus.oauth.getServices(function(services) { 
				var wxService = null;  
				// 遍历所有的服务列表，获取到微信服务  
				for (var i = 0; i < services.length; i++) {  
					if (services[i].id == 'weixin') {  
						wxService = services[i];  
						break;  
					}  
				}  
				// 如果没有微信服务，检查一下前提【manifest.json是否配置】  
				if (!wxService) {  
					plus.nativeUI.alert('当前环境不支持微信登陆');  
					return false;  
				}  
				// 获取微信授权  
				wxService.authorize(function(event) {
					// 授权成功后的处理  
					if (!wxService.authResult){  
						// 微信登录  
						wxService.login(function(res) { 
							// 这里res参数包含有后端需要的参数  
							var access_token = res.target.authResult.access_token;  
							var openid = res.target.authResult.openid;  
							var unionid = res.target.authResult.unionid;  
							var data = {openid: openid, access_token: access_token, unionid: unionid};
							if(openid){
								scope.pagedata.checklogin.item.openid=openid;
								scope.post_json('core/member.auth/base/isapp=1',data);
							}
						}, function(e) {  
							scope.message("登录认证失败:" + JSON.stringify(e),'error');  
						});  
					} else {  
						scope.message("已经授权认证!",'error');  
					}  
				}, function(err) {  
					scope.message("授权失败",'error');  
				}, { scope: 'snsapi_userinfo' });  
			}, function(e) {  
				scope.message("获取服务列表失败:" + e.message + " - " + e.code,'error');  
			});  
		});
	}
	</script>
</div>